<!--
  This template loads for the 'tab.friend-detail' state (app.js)
  'firend' is a $scope variable created in the FriendsCtrl controller (controllers.js)
  The FriendsCtrl pulls data from the Friends service (service.js)
  The Friends service returns an array of friend data
-->
<ion-view title="{{data.title}}" style="background: #1c487f;">
    <div class="bar bar-subheader bar-balanced" ng-show="data.main.eam_wo_status == 4">
        <div class="buttons">
            <button class="button button-icon icon" ng-class="{'ion-compose': !data.showEdit, 'ion-ios7-checkmark-outline': data.showEdit}" ng-click="data.showEdit = !data.showEdit;"></button>
            <h1 class="title">{{'toolbar'|i18ng}}</h1>
            <button class="button button-icon icon ion-forward" ng-click="escalateMaintainenceToReport()" ng-show="!data.showEdit">
            </button>
        </div>
    </div>
    <ion-content class="has-header" ng-class="{'has-subheader': data.main.eam_wo_status == 4}">
        <ion-list id="alarm-detail-list" class="list" show-delete="data.showEdit">
            <ion-item class="item item-divider">
                {{'work_order_status'|i18ng}}
            </ion-item>
            <ion-item class="item">
                {{data.main.eam_wo_status|wostatus}}
            </ion-item>

            <ion-item class="item item-divider">
                {{'work_order_inherit_insp'|i18ng}}
            </ion-item>
            <ion-item class="item">
                {{data.main.eam_maintain_from_insp_id.eam_wo_id}}
            </ion-item>

            <ion-item class="item item-divider">
                {{'eam_wind_turbine_id'|i18ng}}
            </ion-item>
            <ion-item class="item">
                {{data.main.eam_wind_turbine_id}}
            </ion-item>
            <ion-item class="item item-divider">
                {{'eam_component_id'|i18ng}}
            </ion-item>
            <ion-item class="item">
                {{data.main.eam_component_id}}
            </ion-item>
            <ion-item class="item item-divider">
                {{'eam_alarm_level'|i18ng}}
            </ion-item>
            <ion-item class="item">
                {{data.main.eam_alarm_level}}
                <ion-delete-button class="ion-edit button-assertive" ng-click="onModifyAlarmLevel()">
                </ion-delete-button>
            </ion-item>

            <!-- rootCause by prediction engine -->
            <ion-item class="item item-divider">
                {{'eam_root_cause'|i18ng}}
            </ion-item>
            <ion-item class="item-text-wrap">
                <div ng-bind-html="markdown(data.main.eam_root_cause)"></div>
            </ion-item>


            <!-- rootCause by inspection-->
            <ion-item class="item item-divider">
                {{'eam_root_cause_insp'|i18ng}}
            </ion-item>
            <ion-item class="item-text-wrap">
                <div ng-bind-html="markdown(data.main.eam_root_cause_insp)"></div>
            </ion-item>


            <!-- rootCause by maintenance -->
            <ion-item class="item item-divider">
                {{'eam_root_cause_maintain'|i18ng}}
            </ion-item>
            <ion-item class="item-text-wrap">
                <ion-delete-button class="ion-edit button-assertive" ng-click="onModifyRootCause()">
                </ion-delete-button>
                <div ng-bind-html="markdown(data.main.eam_root_cause_maintain)"></div>
            </ion-item>

            <ion-item class="item item-divider">
                {{'eam_maintain_toolkits'|i18ng}}
                <!--tools-->
            </ion-item>
            <ion-item>
                <ion-delete-button class="ion-edit button-assertive" ng-click="onModifyToolkits()">
                </ion-delete-button>
                <ion-list class="list list-inset">
                    <ion-item class="item-thumbnail-left" ng-repeat="x in data.main.eam_maintain_toolkits">
                        <img src="dummy-data/toolkit.jpg">
                        <h2>{{x.name}}</h2>
                        <p class="badge badge-balanced">{{'count'|i18ng}} {{x.count}}</p>
                    </ion-item>
                </ion-list>
            </ion-item>
            <ion-item class="item item-divider">
                {{'eam_maintain_parts'|i18ng}}
                <!--parts-->
            </ion-item>
            <ion-item>
                <ion-delete-button class="ion-edit button-assertive" ng-click="onModifyParts()">
                </ion-delete-button>
                <ion-list class="list list-inset">
                    <ion-item class="item-thumbnail-left" ng-repeat="x in data.main.eam_maintain_parts">
                        <img src="dummy-data/part.png">
                        <h2>{{x.name}}</h2>
                        <p class="badge badge-balanced">{{'count'|i18ng}} {{x.count}}</p>
                    </ion-item>
                </ion-list>
            </ion-item>
            <ion-item class="item item-divider">
                {{'eam_repair_guide'|i18ng}}
                <!--repairGuide-->
            </ion-item>
            <ion-item class="item-text-wrap">
                <ion-delete-button class="ion-edit button-assertive" ng-click="onModifyRepairGuide()">
                </ion-delete-button>
                <div ng-bind-html="markdown(data.main.eam_repair_guide)"></div>
            </ion-item>
            <!-- pending -->
            <!--             <div class="item item-divider">
                维修视频记录
            </div> -->
            <!-- end -->
            <ion-item class="item item-divider">
                {{'eam_repair_consulting'|i18ng}}
                <!--consultingHotLine-->
            </ion-item>
            <ion-item class="item-icon-left item-icon-right">
                <!--                 <ion-delete-button class="ion-edit button-assertive" ng-click="onItemDelete(item)"> -->
                </ion-delete-button>
                <i class="icon ion-chatbubble-working"></i> 400-010-5888888
                <i class="icon ion-ios7-telephone-outline"></i>
            </ion-item>

            <!-- attachPhotoButton -->
            <!-- inspectionFeedback -->
            <!-- partsMainteance historical data -->
        </ion-list>
    </ion-content>
</ion-view>
